Play only 1 audio at a time

When one page have multiple audio. we need play one audio and stop all others. This code work and tested on sermon manager for wordpress plugin. Play one audio at a time. just use this script in jQuery ready block.

$('audio').bind('play', function() {
    var activated = this;
    $('audio').each(function() {
        if(this != activated) this.pause();
    });
});

Leave a Reply

Your email address will not be published. Required fields are marked *